package com.anjie.powerproject.map;

import com.anjie.powerproject.entity.PreStrategy;
import com.anjie.powerproject.entity.StrategyOutput;
import com.anjie.powerproject.pojo.dto.StrategyDTO;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

public interface StrategyMap {

    StrategyDTO toDTO(PreStrategy strategy);

    List<StrategyDTO> toDTO(List<PreStrategy> strategies);

    List<List<StrategyDTO>> toDTOList(List<List<PreStrategy>> strategiesList);

    StrategyDTO toDTO2(StrategyOutput strategy);

    List<StrategyDTO> toDTO2(List<StrategyOutput> strategies);

    List<List<StrategyDTO>> toDTO2List(List<List<StrategyOutput>> strategiesList);

    class Utils {
        public static String toTimeStr(String content) {
            String[] s = content.split(" ");
            return s.length > 0 ? s[0] : "";
        }

        public static String toInfoStr(String content) {
            String[] s = content.split(" ");
            return s.length > 1 ? StringUtils.join(s, " ", 1, s.length) : "";
        }
    }
}
